/**
 * 
 * 
 *  
 *====================================================
 * 文件名称: Encrypt.java
 * 修订记录：
 * No    日期				作者(操作:具体内容)
 * 1.    Mar 3, 2009		(创建:创建文件)
 * 2.    Mar 3, 2009        根据 注释 规范进行调整
 *====================================================
 * 类描述：自定义加密类
 * 
 */
package com.devframe.sys.encrypt;

public class Encrypt {
	public Encrypt() {
	}

	/**
	 * encryptStr
	 * 
	 * @param aspwd
	 *            String
	 * @return String
	 * @author:Administrator
	 */
	public static String encryptStr(String aspwd) {
		String newStr = "";
		String lsPos = "Zl2cWXgObiw8sdzLe4EVuJ1vIo0yfhTmUMHDYxp35kGStK6aNCP7ARFQqnrB9j";
		String lsPwd1 = "lcDH9SxrPEnRF57Xg3aWJICvmjVqw6ztOui4hykp0sf2bMLeoQUANB8dTYZ1KG";
		String lsPwd2 = "R0cfPSxCWq7irkNm2Z8lpobv1uVBwGeE5Ftj3y6KQDIY9AhHJXUd4aOzTnLMgs";
		int liLong;
		int liPos1;
		int liSum;
		String lsMid;
		String lsrt = "";
		String lsApos;
		String lsBpos;
		liSum = 0;
		liLong = aspwd.length();
		for (int i = 0; i < liLong; i++) {
			lsMid = aspwd.substring(i, i + 1);
			liPos1 = lsPos.indexOf(lsMid) + 1;
			liSum = liSum + liPos1;
		}

		if (liSum % 2 != 0) {
			lsApos = lsPwd1;
			lsBpos = lsPwd2;
		} else {
			lsApos = lsPwd2;
			lsBpos = lsPwd1;
		}

		for (int i = 0; i < liLong; i++) {
			lsMid = aspwd.substring(i, i + 1);
			liPos1 = lsApos.indexOf(lsMid);
			lsMid = lsBpos.substring(liPos1, liPos1 + 1);
			lsrt = lsrt + lsMid;
		}

		if (liSum % 2 != 0) {
			newStr = "1" + lsrt;
		} else {
			newStr = "0" + lsrt;
		}

		return newStr;

	}

	/**
	 * 主运行方法
	 * @param args String[]
	 * @author:Administrator
	 */
	public static void main(String[] args) {
		//Encrypt et = new Encrypt();
		String s = encryptStr("123");
		System.out.println(s);
	}

}
